local buffer = require('buffer')
if not buffer then
	print('reuqire buffer fail')
	os.exit(-1)
end

print('version:', buffer.version())
local buf, err = buffer.new()
if not buf then
	print('err:', err)
	os.exit(-1)
end

local i = 0
while i < 128 do
	buf:add("GET /index.html HTTP/1.0\r\nConnection: Close\r\n\r\n")
	i = i + 1
end

print('len:', #buf);
local line = buf:get('*l')
print('line:', line)
print('len:', buf:length())

local data = buf:get('*a')
print('len:', buf:length())
print('data:', data)

buf:close()
print('done')
